﻿using B.S.Traceability.Domain;
using B.S.Traceability.Error;
using B.S.Traceability.Read.API.Application.Commends.Health;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Traceability.Read.API.Controllers
{

    /// <summary>
    /// 保健
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class HealthController : ControllerBase
    {
        private readonly IMediator mediator;

        public HealthController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 显示保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<APIResult<List<Healths>>> GetHealth([FromQuery]GetHealthCommends request, CancellationToken cancellationToken)
        {
           return await mediator.Send(request, cancellationToken);
        }
    }
}
